package com.example.demo.customer;

import org.hibernate.cfg.Environment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CustomerConfiguration {
    @Value("${useFakeCustomerRepo:false}")
    private  Boolean useFakeCustomerRepo;

    @Value("${info.company.name}")
    private String companyName;



    @Autowired
    private Environment environment;
    
    @Bean
    CommandLineRunner commandLineRunner(){
        return args -> {
            System.out.println("CLT hello");
            System.out.println(companyName);
            System.out.println(environment.getProperty("info.app.version"));
            System.out.println(infoApp);

        };
    }
    @Bean
    CustomerRepo customerRepo(){
        System.out.println("useFakeCustomerRepo : "+useFakeCustomerRepo);
        return  new CustomerFakeRepository();
    }
}


